import React, { Component } from 'react';
import {
    Button,
    View,
    Text,
} from 'react-native'

class DetailScreen extends Component {
  state={count:0};
  static navigationOptions = (props) => {
      title:"details"
  };


  // componentWillMount() {                    //通过setParams将increase方法绑定到_increase
  //   this.props.navigation.setParams({ increase: this._increase });
  // }
  _increase=()=>{
    //设置state.count+1
    let count= this.state.count;
    var preState = {
      count:count+1
    }
    this.setState(preState);
  };

  render() {
    return (
      <View >
        <View>
            <Button
                onPress={() => {
                  this._increase();
                }}
                title='点击进入ViewTwo'
            />
        </View>
        <Text>计数为：{this.state.count}</Text>
      </View>
    );
  }
}

export default DetailScreen;
